<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta charset="utf-8"/>
    <title></title>

    <meta name="keywords" content="{$Think.CONFIG.keywords}"/>
    <meta name="description" content="{$Think.CONFIG.description}"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>

    {include file="public/head" /}

</head>
<body>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>

        {include file="public/nav"/}

        {include file="public/menu"/}

        <div class="main-content">
            {include file="public/breadcrumb"/}

            <div class="page-content">
                <div class="row">
                    <div class="cf">
                        <a class="btn btn-info" href="{:Url('add')}">新增</a>
                    </div>

                    <div class="space-4"></div>

                    <table class="table table-bordered table-striped">
                        <tr>
                            <td align="center">姓名</td>
                            <td align="center">地址</td>
                            <td align="center">电话</td>
                            <td align="center">操作</td>
                        </tr>
                        {volist name='list' id='client'}
                        <tr>
                            <td align="center">{$client.name}</td>
                            <td align="center">{$client.address}</td>
                            <td align="center">{$client.phone}</td>
                            <td align="center">
                                <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                                    <button class="btn btn-xs btn-info"
                                            onclick="client.edit('{:url('add',['id'=>$client.id])}');">
                                        <i class="fa fa-edit bigger-120"></i>
                                    </button>
                                    <button class="btn btn-xs btn-danger" onclick="client.del({$client.id});">
                                        <i class="fa fa-trash bigger-120"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                        {/volist}
                    </table>
                    {$list->render()}
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div><!-- /.main-content -->

    </div><!-- /.main-container-inner -->

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="fa fa-angle-double-up fa-only bigger-110"></i>
    </a>
</div>
</body>
{include file="public/footerjs"/}
<script src="__ADMIN__/ace/js/bootbox.min.js"></script>

<script>
    (function () {
        client = {
            edit: function (url) {
                location.href = url;
            },
            del: function (id) {
                $.post("{:url('del')}", {id: id}, function (data) {
                    if (data > 0) {
                        bootbox.alert("删除成功");
                        setTimeout(function () {
                            location.reload();
                        }, 1000)
                    } else {
                        bootbox.alert("删除失败");
                    }
                })
            }
        }
    }());
</script>

{include file="public/foot" /}
